<template>
  <div class="app-container">
    <el-tree :data="categoryDTOList" 
      :props="myProps"></el-tree>

      
  
  </div>
</template>

<script>
import categoryApi from '../../api/product/category.js'
export default {

  data() {
    return {
      categoryDTO:[],//三级ID， category1_id,category2_id,category3_id
      categoryDTOList:[],
      myProps:{
         value:'id',
         label:'name'
      }
    }
  },

  // 生命周期函数：内存准备完毕，页面尚未渲染
  created() {
  },

  // 生命周期函数：内存准备完毕，页面渲染成功
  mounted() {
    this.findCategoryTree();
  },

  methods: {
    findCategoryTree(){
      categoryApi.findCategoryTree().then(res=>{
        this.categoryDTOList = res.data.data;
      })
    },
    categoryDTOChange(){

    }
  }
}
</script>

<style>
 .custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    padding-right: 8px;
  }
</style>


